﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Collections;


namespace ComLib.Web.Lib.Core
{
    public class ViewDataConstants
    {
        public const string IsMultiPartFormData = "IsMultiPartFormData";
        public const string FlashMessages = "flashmessages";
    }



    public class ItemStatus
    {
        public enum Status
        {
            /// <summary>
            /// Only the owner/creater can view the page.
            /// </summary>
            Private = 0,


            /// <summary>
            /// Draft status before requiring review
            /// </summary>
            Draft = 1,


            /// <summary>
            /// Indicates page needs to be reviewed.
            /// </summary>
            Review = 2,


            /// <summary>
            /// Indicates the item has been approved.
            /// </summary>
            Approved = 3,


            /// <summary>
            /// Indicates the page has been approved and published/visible.
            /// </summary>
            Published = 4
        }


        /// <summary>
        /// Gets the status enum from string.
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static Status Convert(string state)
        {
            var status = (Status)Enum.Parse(typeof(Status), state, true);
            return status;
        }



        /// <summary>
        /// String array of all the options.
        /// </summary>
        public static readonly string[] Options = new string[] 
        {
            Status.Private.ToString(), 
            Status.Draft.ToString(),
            Status.Review.ToString(),
            Status.Approved.ToString(),
            Status.Published.ToString()
        };
    }



    public class ItemVisibility
    {
        /// <summary>
        /// The visibility of a page
        /// </summary>
        public enum Visibility
        {
            /// <summary>
            /// Indicates that the page is private to either owner/creator, roles/users
            /// </summary>
            Private = 0,


            /// <summary>
            /// Indicates that hte page is publicly viewable to everyone.
            /// </summary>
            Public = 1,


            /// <summary>
            /// Indicates the page is visible only be password.
            /// </summary>
            Password = 2
        }


        /// <summary>
        /// Gets the status enum from string.
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static Visibility Convert(string visibility)
        {
            var vis = (Visibility)Enum.Parse(typeof(Visibility), visibility, true);
            return vis;
        }



        /// <summary>
        /// String array of all the options.
        /// </summary>
        public static readonly string[] Options = new string[] 
        {
            Visibility.Private.ToString(), 
            Visibility.Public.ToString(),
            //Visibility.Password.ToString(),
        };
    }



    public class ItemPublishStyle
    {
        /// <summary>
        /// The visibility of a page
        /// </summary>
        public enum PublishType
        {
            /// <summary>
            /// Manual publishing.
            /// </summary>
            None,


            /// <summary>
            /// The page gets published via work-flow, from creator, editor, approver, publisher.
            /// </summary>
            Workflow,

            /// <summary>
            /// Automatically publishes on a specific date.
            /// </summary>
            Date,
        }


        /// <summary>
        /// Gets the status enum from string.
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static PublishType Convert(string publishType)
        {
            var publish = (PublishType)Enum.Parse(typeof(PublishType), publishType, true);
            return publish;
        }



        /// <summary>
        /// String array of all the options.
        /// </summary>
        public static readonly string[] Options = new string[] 
        {
            PublishType.None.ToString(), 
            PublishType.Date.ToString(),
            PublishType.Workflow.ToString()
        };
    }
}
